<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增仓库货物')" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-list-add" th:object="${tbGoodsList}">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">商品ID：</label>
                <div class="col-sm-8">
                    <input name="goodsId" th:field="*{goodsId}" class="form-control" type="text" required readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">商品名称：</label>
                <div class="col-sm-8">
                    <input name="goodsName" th:field="*{goodsName}" class="form-control" type="text" required readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">生产厂家：</label>
                <div class="col-sm-8">
                    <input name="manufacturer" th:field="*{manufacturer}" class="form-control" type="text" required readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">商品类型：</label>
                <div class="col-sm-8">
                    <input name="goodsType" th:field="*{goodsType}" class="form-control" type="text" required readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">品牌：</label>
                <div class="col-sm-8">
                    <input name="brand" th:field="*{brand}" class="form-control" type="text" required readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">供应商：</label>
                <div class="col-sm-8">
                    <select name="supplier" class="form-control m-b" th:with="type=${@dict.getType('goods_supplier')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{supplier}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">商品价格：</label>
                <div class="col-sm-8">
                    <input name="goodsPrice" th:field="*{goodsPrice}" class="form-control" min="1" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">数量：</label>
                <div class="col-sm-8">
                    <input name="goodsMount" th:value="1" th:field="*{goodsMount}" class="form-control" min="1"  type="text" required >
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">位置：</label>
                <div class="col-sm-8">
                    <select name="goodsPosition" class="form-control m-b" th:with="type=${@dict.getType('goods_goodsPosition')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{goodsPosition}"></option>
                    </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var prefix = ctx + "business/list"
        $("#form-list-add").validate({
            rules:{
                dictSort:{
                    goodsPrice:true,
                    goodsMount:true
                },
            },
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-list-add').serialize());
            }
        }
    </script>
</body>
</html>